<template>
<div class="img-msg-list views-container">
    <div class="wlm-table">
        <div class="wlm-table-hearder-btn">
            <router-link class="wlm-text" tag="span" :to="{path:'/application/imgMsgListAdd'}">
                <el-button size="small" type="primary">增加公众号推送消息</el-button>
            </router-link>
            <!-- <router-link class="wlm-text" tag="span" :to="{path:'/application/lotteryAdd'}">
                <el-button size="small" type="primary">查看模板消息推送日志</el-button>
            </router-link> -->
        </div>
        <div class="wlm-table-content">
            <el-table :ref="tableFormatData.userTable.key" :data="tableFormatData.userTable.tableData" @selection-change="handleSelectionChange" style="width: 100%">
                <el-table-column type="selection" width="55">
                </el-table-column>
                <el-table-column prop="date" label="标题名称">
                    <template slot-scope="scope">
                        <span>{{scope.row.title}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="共发送">
                    <template slot-scope="scope">
                        <span>{{scope.row.send_num}}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="name" label="添加时间">
                    <template slot-scope="scope">
                        <span>{{scope.row.create_time}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="操作">
                    <template slot-scope="scope">
                        <div class="operation-group">
                            <router-link class="wlm-text" tag="a"  :to="{path:'/application/imgMsgListAdd', query :{ 
                              t_id:scope.row.t_id,
                              store_user_id:$route.query.store_user_id?$route.query.store_user_id:'',
                              h_aid:$route.query.h_aid?$route.query.h_aid:'',
                              }}">
                                <el-button type="text">编辑</el-button>
                            </router-link>
                            <div class="btn-line"></div>
                            <router-link class="wlm-text" tag="a" target="_blank" :to="{path:'/application/imgQueue', query :{ 
                              title:scope.row.title,method:'3',
                              store_user_id:$route.query.store_user_id?$route.query.store_user_id:'',
                              h_aid:$route.query.h_aid?$route.query.h_aid:'',
                              }}">
                                <el-button type="text">详细资料</el-button>
                            </router-link>
                            <div class="btn-line"></div>
                            <el-button class="wlm-text" type="text" @click="delTableItem(scope.row.t_id)">删除</el-button>
                        </div>
                    </template>
                </el-table-column>
            </el-table>
            <div class="pagination-content flex-row flex-justify-b flex-align-c">
                <el-row class="pagination-btns">
                    <el-checkbox class="check-all" true-label="1" false-label="0" v-model="tableFormatData.userTable.files.checkall" @change="toggleSelection">全部</el-checkbox>
                    <el-button class="right-8" :disabled="isGroup" size="mini" @click="delTableList">删除</el-button>
                </el-row>
                <el-pagination :disabled="!hasTableData" @size-change="listPageChange" @current-change="listPageChange" :current-page.sync="tableFormatData.userTable.pagination.page" :page-sizes="tableFormatData.userTable.pagination.pagesizes" :page-size.sync="tableFormatData.userTable.pagination.list_rows" layout="total, sizes, prev, pager, next, jumper" :total="hasTableData?tableFormatData.userTable.pagination.total : 0">
                </el-pagination>
            </div>
        </div>
    </div>
</div>
</template>

<script>
import {
  templateIndex,
  templateDel
} from '@/api/application'
import mixins from '@/mixins/mixins'
export default {
  mixins: [mixins.getters('Table')],
  name: 'ImgMsgList',
  components: {
  },
  created() {
    // applyStatistics().then((response) => {
    //   const {
    //     data: {
    //       data: msgData = []
    //     }
    //   } = response
    //   this.categoryData = msgData
    //   console.log(this.categoryData)
    // })
  },
  data() {
    return {
      categoryData: {},
      openDialogText: '',
      tableFormatData: {
        current: 'userTable',
        userTable: {
          key: 'userTable',
          api: {
            getList: templateIndex,
            delList: templateDel
          },
          tableData: [],
          files: {
            ids: [],
            checkall: '0',
            Recycle: '1'
          },
          pagination: {
            page: 1,
            list_rows: 10,
            pagesizes: [10, 20, 50],
            total: 0
          }
        }
      }
    }
  },
  methods: {
  }
}
</script>
